package com.cqc.jdk8.Jutil.function;

import com.cqc.other.methodContest.Person;
import org.junit.Test;

import java.util.function.Supplier;

/**
 * Supplier 提供者， 无参数 有返回值
 */
public class SupplierTest {


    @Test
    public void f1() {
        Supplier<Person> s1 = Person::new;
        Person person = s1.get();
    }

    @Test
    public void f2() {
        f2_1(()->{
            return "A";
        });
    }

    public void f2_1(Supplier<String> supplier) {
        System.out.println("开始");
        String str = supplier.get();
        System.out.println("str=" + str);
    }
}
